package JUnit;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.junit.Test;

import DAO.user_bookDAO;
import Model.user_book;

public class TestUser_Book {
	//测试成功 问题：sql语句写错
	@Test
	public void test1(){
		Configuration cfg = new Configuration().configure();
		SessionFactory sf = cfg.buildSessionFactory();
		Session session = sf.openSession();
		Transaction tx = session.beginTransaction();
		List list = user_bookDAO.user_bookList(session, 2);
		tx.commit();
		user_book t = (user_book) list.get(0);
		System.out.println(t.getBookname());
		session.close();
	}
}
